<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>28-侦听器的基本用法</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <style></style>
  </head>
  <body>
    <div id="app">
      <input type="text" v-model="numA" />
      <input type="text" v-model="numb" />
      <!-- <span>{{fullUserName()}}</span> -->
      <br />
      <span>{{numA}}</span>
      <br />
      <span>{{numb}}</span>
    </div>
    <script>
      var vm = new Vue({
        el: '#app',
        data: {
          numA: 'A',
          numb: 'b',
          fullName: '',
        },
        methods: {
          // fullUserName: function () {
          //   return this.numA + this.numb;
          // },
        },
        watch: {
          numA: function (val) {
            console.log(val);
            this.numA = this.fullName + val;
          },
          numb: function (val) {
            this.numb = this.fullName + val;
          },
        },
      });
    </script>
  </body>
</html>
